package service;

import dao.UserDao;
import domain.User;

public class registservice {
    private UserDao userDao = new UserDao();
    /**
     * 注册用户
     * @param user
     * @return
     */
   // @Override
    public boolean regist(User user) {
        //1.根据用户名查询用户对象
//        System.out.println("111这里是service层");
//        System.out.println(user.getUsername());
//        System.out.println("111这里是service层");

//        User u = userDao.findByUsername(user.getUsername());
//        //判断 u 是否为 null
//        if(u != null){
//            //用户名存在，注册失败
//            return false;
//        }
        //2.保存用户信息
        System.out.println("222这里是service层");
        System.out.println(user.getUsername());
        System.out.println("222这里是service层");
        userDao.save(user);
        return true;
    }
}

